Scalable pipeline for local ancestry inference

ABSTRACT

Ancestry deconvolution includes obtaining unphased genotype data of an individual; phasing, using one or more processors, the unphased genotype data to generate phased haplotype data; using a learning machine to classify portions of the phased haplotype data as corresponding to specific ancestries respectively and generate initial classification results; and correcting errors in the initial classification results to generate modified classification results.

INCORPORATION BY REFERENCE

An Application Data Sheet is filed concurrently with this specification as part of the present application. Each application that the present application claims benefit of or priority to as identified in the concurrently filed Application Data Sheet is incorporated by reference herein in its entirety and for all purposes.

BACKGROUND OF THE INVENTION

Ancestry deconvolution refers to identifying the ancestral origin of chromosomal segments in individuals. Ancestry deconvolution in admixed individuals (i.e., individuals whose ancestors such as grandparents are from different regions) is straightforward when the ancestral populations considered are sufficiently distinct (e.g., one grandparent is from Europe and another from Asia). To date, however, existing approaches are typically ineffective at distinguishing between closely related populations (e.g., within Europe). Moreover, due to their computational complexity, most existing methods for ancestry deconvolution are unsuitable for application in large-scale settings, where the reference panels used contain thousands of individuals.

BRIEF DESCRIPTION OF THE DRAWINGS

Various embodiments of the invention are disclosed in the following detailed description and the accompanying drawings.

FIG. 1 is a functional diagram illustrating a programmed computer system for performing the pipelined ancestry prediction process in accordance with some embodiments.

FIG. 2 is a block diagram illustrating an embodiment of an ancestry prediction platform.

FIG. 3 is an architecture diagram illustrating an embodiment of an ancestry prediction system.

FIG. 4 is a flowchart illustrating an embodiment of a process for ancestry prediction.

FIG. 5A illustrates an example of a section of unphased genotype data.

FIG. 5B illustrates an example of two sets of phased genotype data.

FIG. 6 is a flowchart illustrating an embodiment of a process for performing out-of-sample phasing.

FIG. 7 is a diagram illustrating an example of a predetermined reference haplotype graph that is built based on a reference collection of genotype data.

FIGS. 8A-8B are diagrams illustrating embodiments of modified haplotype graphs.

FIG. 9 is a diagram illustrating an embodiment of a compressed haplotype graph with segments.

FIG. 10 is a diagram illustrating an embodiment of a dynamic Bayesian network used to implement trio-based phasing.

FIG. 11 is a flowchart illustrating an embodiment of a process to perform trio-based phasing.

FIG. 12 is a flowchart illustrating an embodiment of a local classification process.

FIG. 13 is a diagram illustrating how a set of reference data points is classified into two classes by a binary SVM.

FIG. 14 is a diagram illustrating possible errors in an example classification result.

FIG. 15 is a graph illustrating embodiments of Hidden Markov Models used to model phasing errors.

FIG. 16 shows two example graphs corresponding to basic HMMs used to model phasing errors of two example haplotypes of a chromosome.

FIG. 17 is an example graph of a Pair Hidden Markov Model (PHMM).

FIG. 18 is an example graph of an Autoregressive Pair Hidden Markov Model (APHMM).

FIG. 19 is an example data table displaying the emission parameters.

FIGS. 20A-20D are example ancestry assignment plots illustrating different results that are obtained using different techniques.

FIG. 21 is a table comparing the predictive accuracies of ancestry assignments with and without error correction.

FIG. 22A illustrates example reliability plots for East Asian population and East European population before recalibration.

FIG. 22B illustrates example reliability plots for East Asian population and East European population after recalibration.

FIG. 23A is a flowchart illustrating an embodiment of a label clustering process.

FIG. 23B is an example illustrating process 2300 of FIG. 23A.

FIG. 24 is a flowchart illustrating an embodiment of a process for displaying ancestry information.

FIG. 25 is a diagram illustrating an embodiment of a regional view of ancestry composition information for an individual.

FIG. 26 is a diagram illustrating an embodiment of an expanded view of ancestry composition information for an individual.

FIG. 27 is a diagram illustrating an embodiment of a further expanded view of ancestry composition information for an individual.

FIG. 28 is a diagram illustrating an embodiment of an inheritance view.

FIGS. 29-30 are diagrams illustrating embodiments of a chromosome-specific view.

DETAILED DESCRIPTION

The invention can be implemented in numerous ways, including as a process; an apparatus; a system; a composition of matter; a computer program product embodied on a computer readable storage medium; and/or a processor, such as a processor configured to execute instructions stored on and/or provided by a memory coupled to the processor. In this specification, these implementations, or any other form that the invention may take, may be referred to as techniques. In general, the order of the steps of disclosed processes may be altered within the scope of the invention. Unless stated otherwise, a component such as a processor or a memory described as being configured to perform a task may be implemented as a general component that is temporarily configured to perform the task at a given time or a specific component that is manufactured to perform the task. As used herein, the term ‘processor’ refers to one or more devices, circuits, and/or processing cores configured to process data, such as computer program instructions.

A detailed description of one or more embodiments of the invention is provided below along with accompanying figures that illustrate the principles of the invention. The invention is described in connection with such embodiments, but the invention is not limited to any embodiment. The scope of the invention is limited only by the claims and the invention encompasses numerous alternatives, modifications and equivalents. Numerous specific details are set forth in the following description in order to provide a thorough understanding of the invention. These details are provided for the purpose of example and the invention may be practiced according to the claims without some or all of these specific details. For the purpose of clarity, technical material that is known in the technical fields related to the invention has not been described in detail so that the invention is not unnecessarily obscured.

A pipelined ancestry deconvolution process to predict an individual's ancestry based on genetic information is disclosed. Unphased genotype data associated with the individual's chromosomes is received and phased to generate phased haplotype data. In some embodiments, dynamic programming that does not require the unphased genotype data to be included in the reference data is implemented to facilitate phasing. The phased data is divided into segments, which are classified as being associated with specific ancestries. The classification is performed using a learning machine in some embodiments. The classification output undergoes an error correction process to reduce noise and correct for any phasing errors (also referred to as switch errors) and/or correlated classification errors. The error corrected output is optionally recalibrated, and ancestry labels are optionally clustered according to a geographical hierarchy to be displayed to the user.

In some embodiments, genotype data comprising gene sequences and/or genetic markers is used to represent an individual's genome. Examples of such genetic markers include Single Nucleotide Polymorphisms (SNPs), which are points along the genome, each corresponding to two or more common variations; Short Tandem Repeats (STRs), which are repeated patterns of two or more repeated nucleotide sequences adjacent to each other; and Copy-Number Variants (CNVs), which include longer sequences of deoxyribonucleic acid (DNA) that could be present in varying numbers in different individuals. Although SNP-based genotype data is described extensively below for purposes of illustration, the technique is also applicable to other types of genotype data such as STRs and CNVs. As used herein, a haplotype refers to DNA on a single chromosome of a chromosome pair. Haplotype data representing a haplotype can be expressed as a set of markers (e.g., SNPs, STRs, CNVs, etc.) or a full DNA sequence set.

FIG. 1 is a functional diagram illustrating a programmed computer system for performing the pipelined ancestry prediction process in accordance with some embodiments. Computer system 100, which includes various subsystems as described below, includes at least one microprocessor subsystem (also referred to as a processor or a central processing unit (CPU)) 102. For example, processor 102 can be implemented by a single-chip processor or by multiple processors. In some embodiments, processor 102 is a general purpose digital processor that controls the operation of the computer system 100. Using instructions retrieved from memory 110, the processor 102 controls the reception and manipulation of input data, and the output and display of data on output devices (e.g., display 118). In some embodiments, processor 102 includes and/or is used to provide phasing, local classification, error correction, recalibration, and/or label clustering as described below.

Processor 102 is coupled bi-directionally with memory 110, which can include a first primary storage, typically a random access memory (RAM), and a second primary storage area, typically a read-only memory (ROM). As is well known in the art, primary storage can be used as a general storage area and as scratch-pad memory, and can also be used to store input data and processed data. Primary storage can also store programming instructions and data, in the form of data objects and text objects, in addition to other data and instructions for processes operating on processor 102. Also as is well known in the art, primary storage typically includes basic operating instructions, program code, data, and objects used by the processor 102 to perform its functions (e.g., programmed instructions). For example, memory 110 can include any suitable computer-readable storage media, described below, depending on whether, for example, data access needs to be bi-directional or uni-directional. For example, processor 102 can also directly and very rapidly retrieve and store frequently needed data in a cache memory (not shown).

A removable mass storage device 112 provides additional data storage capacity for the computer system 100, and is coupled either bi-directionally (read/write) or uni-directionally (read only) to processor 102. For example, storage 112 can also include computer-readable media such as magnetic tape, flash memory, PC-CARDS, portable mass storage devices, holographic storage devices, and other storage devices. A fixed mass storage 120 can also, for example, provide additional data storage capacity. The most common example of mass storage 120 is a hard disk drive. Mass storage 112, 120 generally store additional programming instructions, data, and the like that typically are not in active use by the processor 102. It will be appreciated that the information retained within mass storage 112 and 120 can be incorporated, if needed, in standard fashion as part of memory 110 (e.g., RAM) as virtual memory.

In addition to providing processor 102 access to storage subsystems, bus 114 can also be used to provide access to other subsystems and devices. As shown, these can include a display monitor 118, a network interface 116, a keyboard 104, and a pointing device 106, as well as an auxiliary input/output device interface, a sound card, speakers, and other subsystems as needed. For example, the pointing device 106 can be a mouse, stylus, track ball, or tablet, and is useful for interacting with a graphical user interface.

The network interface 116 allows processor 102 to be coupled to another computer, computer network, or telecommunications network using a network connection as shown. For example, through the network interface 116, the processor 102 can receive information (e.g., data objects or program instructions) from another network or output information to another network in the course of performing method/process steps. Information, often represented as a sequence of instructions to be executed on a processor, can be received from and outputted to another network. An interface card or similar device and appropriate software implemented by (e.g., executed/performed on) processor 102 can be used to connect the computer system 100 to an external network and transfer data according to standard protocols. For example, various process embodiments disclosed herein can be executed on processor 102, or can be performed across a network such as the Internet, intranet networks, or local area networks, in conjunction with a remote processor that shares a portion of the processing. Additional mass storage devices (not shown) can also be connected to processor 102 through network interface 116.

An auxiliary I/O device interface (not shown) can be used in conjunction with computer system 100. The auxiliary I/O device interface can include general and customized interfaces that allow the processor 102 to send and, more typically, receive data from other devices such as microphones, touch-sensitive displays, transducer card readers, tape readers, voice or handwriting recognizers, biometrics readers, cameras, portable mass storage devices, and other computers.

In addition, various embodiments disclosed herein further relate to computer storage products with a computer readable medium that includes program code for performing various computer-implemented operations. The computer-readable medium is any data storage device that can store data which can thereafter be read by a computer system. Examples of computer-readable media include, but are not limited to, all the media mentioned above: magnetic media such as hard disks, floppy disks, and magnetic tape; optical media such as CD-ROM disks; magneto-optical media such as optical disks; and specially configured hardware devices such as application-specific integrated circuits (ASICs), programmable logic devices (PLDs), and ROM and RAM devices. Examples of program code include both machine code, as produced, for example, by a compiler, or files containing higher level code (e.g., script) that can be executed using an interpreter.

The computer system shown in FIG. 1 is but an example of a computer system suitable for use with the various embodiments disclosed herein. Other computer systems suitable for such use can include additional or fewer subsystems. In addition, bus 114 is illustrative of any interconnection scheme serving to link the subsystems. Other computer architectures having different configurations of subsystems can also be utilized.

FIG. 2 is a block diagram illustrating an embodiment of an ancestry prediction platform. In this example, a user uses a client device 202 to communicate with an ancestry prediction system 206 via a network 204. Examples of device 202 include a laptop computer, a desktop computer, a smart phone, a mobile device, a tablet device or any other computing device. Ancestry prediction system 206 is used to perform a pipelined process to predict ancestry based on a user's genotype information. Ancestry prediction system 206 can be implemented on a networked platform (e.g., a server or cloud-based platform, a peer-to-peer platform, etc.) that supports various applications. For example, embodiments of the platform perform ancestry prediction and provide users with access (e.g., via appropriate user interfaces) to their personal genetic information (e.g., genetic sequence information and/or genotype information obtained by assaying genetic materials such as blood or saliva samples) and predicted ancestry information. In some embodiments, the platform also allows users to connect with each other and share information. Device 100 can be used to implement 202 or 206.

In some embodiments, DNA samples (e.g., saliva, blood, etc.) are collected from genotyped individuals and analyzed using DNA microarray or other appropriate techniques. The genotype information is obtained (e.g., from genotyping chips directly or from genotyping services that provide assayed results) and stored in database 208 and is used by system 206 to make ancestry predictions. Reference data, including genotype data of unadmixed individuals (e.g., individuals whose ancestors came from the same region), simulated data (e.g., results of machine-based processes that simulate biological processes such as recombination of parents' DNA), pre-computed data (e.g., a precomputed reference haplotype graph used in out-of-sample phasing) and the like can also be stored in database 208 or any other appropriate storage unit.

FIG. 3 is an architecture diagram illustrating an embodiment of an ancestry prediction system. System 300 can be used to implement 206 of FIG. 2 , and can be implemented using system 100 of FIG. 1 . The processing pipeline of system 300 includes a phasing module 302, a local classification module 304, and an error correction module 306. These modules form a predictive engine that makes predictions about the respective ancestries that correspond to the individual's chromosome portions. Optionally, a recalibration module 308 and/or a label clustering module 310 can also be included to refine the output of the predictive engine.

The input to phasing module 302 comprises unphased genotype data, and the output of the phasing module comprises phased genotype data (e.g., two sets of haplotype data). In some embodiments, phasing module 302 performs out-of-sample phasing where the unphased genotype data being phased is not included in the reference data used to perform phasing. The phased genotype data is input into local classification module 304, which outputs predicted ancestry information associated with the phased genotype data. In some embodiments, the phased genotype data is segmented, and the predicted ancestry information includes one or more ancestry predictions associated with the segments. The posterior probabilities associated with the predictions are also optionally output. The predicted ancestry information is sent to error correction module 306, which averages out noise in the predicted ancestry information and corrects for phasing errors introduced by the phasing module and/or correlated prediction errors introduced by the local classification module. The output of the error correction module can be presented to the user (e.g., via an appropriate user interface). Optionally, the error correction module sends its output (e.g., error corrected posterior probabilities) to a recalibration module 308, which recalibrates the output to establish confidence levels based on the error corrected posterior probabilities. Also optionally, the calibrated confidence levels are further sent to label clustering module 310 to identify appropriate ancestry assignments that meet a confidence level requirement.

The modules described above can be implemented as software components executing on one or more processors, as hardware such as programmable logic devices and/or Application Specific Integrated Circuits designed to perform certain functions or a combination thereof. In some embodiments, the modules can be embodied by a form of software products which can be stored in a nonvolatile storage medium (such as optical disk, flash storage device, mobile hard disk, etc.), including a number of instructions for making a computer device (such as personal computers, servers, network equipment, etc.) implement the methods described in the embodiments of the present application. The modules may be implemented on a single device or distributed across multiple devices. The functions of the modules may be merged into one another or further split into multiple sub-modules.

In addition to being a part of the pipelined ancestry prediction process, the modules and their outputs can be used in other applications. For example, the output of the phasing module can be used to identify familial relatives of individuals in the reference database.

FIG. 4 is a flowchart illustrating an embodiment of a process for ancestry prediction. Process 400 initiates at 402, when unphased genotype data associated with one or more chromosomes of an individual is obtained. The unphased genotype data can be received from a data source such as a database or a genotyping service, or obtained by user upload. At 404, the unphased genotype data is phased using an out-of-sample technique to generate two sets of phased haplotype data. Each set of phased haplotype data corresponds to the DNAs the individual inherited from one biological parent. At 406, a learning machine (e.g., a support vector machine (SVM)) is used to classify portions of the two sets of haplotype data as being associated with specific ancestries respectively, and generate ancestry classification results. At 408, errors in the results of the ancestry classification are corrected. In some embodiments, error correction removes noise, corrects phasing errors and/or correlated prediction errors. Optionally, at 410, the error corrected predicted ancestry information is recalibrated to establish confidence levels. Optionally, at 412, the recalibrated confidence levels and their associated ancestry assignments are clustered as appropriate to identify ancestry assignments that meet a confidence level requirement. Optionally, at 414, the resulting confidence levels and their associated ancestry assignments are stored to a database and/or output to another application (e.g., an application that analyzes the results and/or displays predicted ancestry information to users).

Details of the modules and their operations are described below.

Phasing

At a given gene locus on a pair of autosomal chromosomes, a diploid organism (e.g., a human being) inherits one allele of the gene from the mother and another allele of the gene from the father. At a heterozygous gene locus, two parents contribute different alleles (e.g., one A and one C). Without additional processing, it is impossible to tell which parent contributed which allele. Such genotype data that is not attributed to a particular parent is referred to as unphased genotype data. Typically, initial genotype readings obtained from genotyping chips manufactured by companies such as Illumina® are in an unphased form.

FIG. 5A illustrates an example of a section of unphased genotype data. Genotype data section 502 includes genotype calls at known SNP locations of a chromosome pair. The process of phasing is to split a stretch of unphased genotype calls such as 502 into two sets of phased genotype data (also referred to as haplotype data) attributed to a particular parent. Phasing is needed for identifying ancestry from each parent and classifying haplotypes from different ancestral origins. Further, a specific marker alone tends not to offer good ancestral (e.g., geographical or ethic) specificity, but a run of multiple markers can offer better specificity. For example, a particular SNP of “A” is not very informative with respect to the ancestry origin of the section of DNA, but a haplotype of a longer stretch (e.g., “ACGA”) starting at a specific location can be highly correlated with Northern European ancestry.

FIG. 5B illustrates an example of two sets of phased genotype data. In this example, phased genotype data (i.e., haplotype data) 504 and 506 is obtained from unphased genotype data 502 based on statistical techniques. Haplotype block 504 (“ACGT”) is determined to be attributed to (i.e., inherited from) one parent, and haplotype block 506 (“AACC”) is determined to be attributed to another parent.

Population-Based Phasing

Phasing is often done using statistical techniques. Such techniques are also referred to as population-based phasing because genotype data from a reference collection of a population of individuals (e.g., a few hundred to a thousand) is analyzed. BEAGLE is a commonly used population-based phasing technique. It makes statistical determinations based on the assumption that certain blocks of haplotypes are inherited in blocks and therefore shared amongst individuals. For example, if the genotype data of a sample population comprising many individuals shows a common pattern of “?A ?C ?G ?T” (where “?” can be any other allele), then the block “ACGT” is likely to be a common block of haplotypes that is present in these individuals. The population-based phasing technique would therefore identify the block “ACGT” as coming from one parent whenever “?A ?C ?G ?T” is present in the genotype data. Because BEAGLE requires that the genotype data being analyzed be included in the reference collection, the technique is referred to as in-sample phasing.

In-sample phasing is often computationally inefficient. Phasing of a large database of a user's genome (e.g., 100,000 or more) can take many days, and it can take just as long whenever a new user has to be added to the database since the technique would recompute the full set of data (including the new user's data). There can also be mistakes during in-sample phasing. One type of mistake, referred to as phasing errors or switch errors, occurs where a section of the chromosome is in fact attributed to one parent but is misidentified as attributed to another parent. Switch errors can occur when a stretch of genotype data is not common in the reference population. For example, suppose that a parent actually contributed the haplotype of “ACCC” and another parent actually contributed the haplotype of “AAGT” to genotype 502. Because the block “ACGT” is common in the reference collection and “ACCC” has never appeared in the reference collection, the technique attributes “ACGT” and “AACC” to two parents respectively, resulting in a switch error.

Embodiments of the phasing technique described below permit out-of-sample population-based phasing. In out-of-sample phasing, when genotype data of a new individual needs to be phased, the genotype data is not necessarily immediately combined with the reference collection to obtain phasing for this individual. Instead, a precomputed data structure such as a predetermined reference haplotype graph is used to facilitate a dynamic programming based process that quickly phases the genotype data. For example, given the haplotype graph and unphased data, the likely sequence of genotype data can be solved using the Viterbi algorithm. This way, on a platform with a large number of users forming a large reference collection (e.g., at least 100,000 individuals), when a new individual signs up with the service and provides his/her genotype data, the platform is able to quickly phase the genotype data without having to recompute the common haplotypes of the existing users plus the new individual.

FIG. 6 is a flowchart illustrating an embodiment of a process for performing out-of-sample phasing. Process 600 can be performed on a system such as 100 or 206, and can be used to implement phasing module 302.

At 602, unphased genotype data of the individual is obtained. In some embodiments, the unphased genotype data such as sequence data 502 is received from a database, a genotyping service, or as an upload by a user of a platform such as 100.

At 604, the unphased genotype data is processed using dynamic programming to determine phased data, i.e., sets of likely haplotypes. The processing requires a reference population and is therefore referred to as population-based phasing. In some embodiments, the dynamic programming relies on a predetermined reference haplotype graph. The predetermined haplotype graph is precomputed without referencing the unphased genotype data of the individual. Thus, the unphased genotype data is said to be out-of-sample with respect to a collection of reference genotype data used to compute the predetermined reference haplotype graph. In other words, if the unphased genotype data is from a new user whose genotype data is not already included in the reference genotype data and therefore is not incorporated into the predetermined reference haplotype graph, it is not necessary to include the unphased genotype data from the new user in the reference genotype data and recompute the reference haplotype graph. Details of dynamic programming and the predetermined reference haplotype graph are described below.

At 606, trio-based phasing is optionally performed to improve upon the results from population-based phasing. As used herein, trio-based phasing refers to phasing by accounting for the genotyping data of one or more biological parents of the individual.

At 608, the likely haplotype data is output to be stored to a database and/or processed further. In some embodiments, the likely haplotype data is further processed by a local classifier as shown in FIG. 3 for ancestry prediction purposes.

The likely haplotype data can also be used in other applications, such as being compared with haplotype data of other individuals in a database to identify the amount of DNA shared among individuals, thereby determining people who are related to each other and/or people belonging to the same population groups.

In some embodiments, the dynamic programming process performed in step 604 uses a predetermined reference haplotype graph to examine possible sequences of haplotypes that could be combined to generate the unphased genotype data, and determine the most likely sequences of haplotypes. Given a collection of binary strings of length L, a haplotype graph is a probabilistic deterministic finite automaton (DFA) defined over a directed acyclic graph. The nodes of the multigraph are organized into L+1 levels (numbered from 0 to L), such that level 0 has a single node representing the source (i.e., initial state) of the DFA and level L has a single node representing the sink (i.e., accepting state) of the DFA. Every directed edge in the multigraph connects a node from some level i to a node in level (i+1) and is labeled with either 0 or 1. Every node is reachable from the source and has a directed path to the sink. For each path through the haplotype graph from the source to the sink, the concatenation of the labels on the edges traversed by the path is a binary string of length L. Semantically, paths through the graph represent haplotypes over a genomic region comprising L biallelic markers (assuming an arbitrary binary encoding of the alleles at each site). A probability distribution over the set of haplotypes included in a haplotype graph can be defined by associating a conditional probability with each edge (such that the sum of the probabilities of the outgoing edges for each node is equal to 1), and generated by starting from the initial state at level 0, and choosing successor states by following random outgoing edges according to their assigned conditional probabilities.

FIG. 7 is a diagram illustrating an example of a predetermined reference haplotype graph that is built based on a reference collection of genotype data (e.g., population-based data). In this example, the reference collection of genotype data includes a set of L genetic markers (e.g., SNPs). Haplotype graph 700 is a Directed Acyclic Graph (DAG) having nodes (e.g., 704) and edges (e.g., 706). The haplotype graph starts with a single node (the “begin state”) and ends on a single node (the “accepting state”), and the intermediate nodes correspond to the states of the markers at respective gene loci. There are a total of L+1 levels of nodes from left to right. An edge, e, represents the set of haplotypes whose path from the initial node to the terminating node of the graph traverses e. The possible paths define the haplotype space of possible genotype sequences. For example, in haplotype graph 700, a possible path 702 corresponds to the genotype sequence “GTTCAC”. There are four possible paths/genotype sequences in the haplotype space shown in this diagram (“ACGCGC,” “ACTTAC,” “GTTCAC,” and “GTTTGG”).

Each edge is associated with a probability computed based on the reference collection of genotype data. In this example, a collection of genotype data is comprised of genotype data from 1000 individuals, of which 400 have the “A” allele at the first locus, and 600 have the “G” allele at the first locus. Accordingly, the probability associated with edge 708 is 400/1000 and the probability associated with edge 710 is 600/1000. All of the first 400 individuals have the “C” allele at the second locus, giving edge 712 a probability of 400/400. All of the next 600 individuals who had the “G” allele at the first locus have the “T” allele at the second locus, giving edge 714 a probability of 600/600, and so on. The probabilities associated with the respective edges are labeled in the diagram. The probability associated with a specific path is expressed as the product of the probabilities associated with the edges included in the path. For example, the probability associated with path 702 is computed as:

${P(h)} = {{\left( \frac{600}{1000} \right)\left( \frac{600}{600} \right)\left( \frac{600}{600} \right)\left( \frac{50}{600} \right)\left( \frac{350}{350} \right)\left( \frac{450}{450} \right)} = {{0.0}5}}$

The dynamic programming process searches the haplotype graph for possible paths, selecting two paths h₁ and h₂ for which the product of their associated probabilities is maximized, subject to the constraint that when the two paths are combined, the alleles at each locus must match the corresponding alleles in the unphased genotype data (g). The following expression is used in some cases to characterize the process: maximize P(h ₁)P(h ₂),subject to h ₁ +h ₂ =g

For out-of-sample phasing, the reference haplotype graph is built once and reused to identify possible haplotype paths that correspond to the unphased genotype data of a new individual (a process also referred to as “threading” the new individual's haplotype along the graph). The individual's genotype data sometimes does not correspond to any existing path in the graph (e.g., the individual has genotype sequences that are unique and not included in the reference population), and therefore cannot be successfully threaded based on existing paths of the reference haplotype graph. To cope with the possibility of a non-existent path, several modifications are made to the reference haplotype graph to facilitate the out-of-sample phasing process.

FIGS. 8A-8B are diagrams illustrating embodiments of modified haplotype graph used for out-of-sample, population-based phasing. In these examples, modified reference haplotype graphs 800 and 850 are based on graph 700. Unlike graph 700, which is based on exact readings of genotype sequences of the reference individuals, the modified graphs permit recombination and genotyping errors and include modifications (e.g., extra edges) that account for recombination and genotyping errors.

Recombination is one reason to extend graph 700 for out-of-sample phasing. As used herein, recombination refers to the switching of a haplotype along one path to a different path. Recombination can happen when segments of parental chromosomes cross over during meiosis. In some embodiments, reference haplotype graph 700 is extended to account for the possibility of recombination/path switching. Recombination events are modeled by allowing a new haplotype state to be selected (independent of the previous haplotype state) with probability τ at each level of the haplotype graph. By default, τ≈0.00448, which is an estimate of the probability of recombination between adjacent sites, assuming 500,000 uniformly spaced markers, a genome length of 37.5 Morgans, and 30 generations since admixture. Referring to the example of FIG. 8A, suppose the new individual's unphased genotype data is “AG, CT, TT, TT, GG, GG,” (SEQ ID NO: 1) which cannot be split into two haplotypes by threading along existing paths in graph 700. The modified reference haplotype graph 800 permits recombination by including additional edges representing recombination (e.g., edge 804) so that new paths can be formed along these edges. In this example, the unphased genotype data can map onto two paths corresponding to haplotypes “ACTTGG” and “GTTTGG”, the former being a new path due to recombination with a recombination occurring between “C” and “T” along edge 804. τ is associated with edge 804 and used to compute the probability of the path through 804.

Genotyping error is another reason to extend graph 700 for out-of-sample phasing. Genotyping errors can occur because the genotyping technology is imperfect and can make false readings. The rate of genotyping error for a given technology (e.g., a particular genotyping chip) can be obtained from the manufacturer. In some embodiments, when the search for possible paths for a new individual cannot be done according to the existing reference graph, the existing reference haplotype graph is extended to account for the possibility of genotyping errors. For example, suppose the new individual's unphased genotype data is “AG, CT, GG, CT, GG, CG,” (SEQ ID NO: 2) which cannot be split into two haplotypes by threading along existing paths in graph 700. Referring to FIG. 8B, the reference haplotype graph is extended to permit genotyping errors and a new edge 852 is added to the graph, permitting a reading of “G” instead of “T” at this locus. The probability associated with this edge is determined based on the rate of genotyping error for the genotyping technology used. The unphased genotype data can therefore be split into haplotypes “ACGCGC” and “GTGTGG”, the latter being a new path based on the extended reference haplotype graph. In some embodiments, to account for genotyping error, the out-of-sample phaser explicitly allows genotyping error with a constant probability of y (which depends on the error rate of the given technology, and is set to 0.01 in some cases) for each emitted edge label.

The example graphs shown include a small number of nodes and edges, and thus represent short sequences of genotype data. In practice, the begin state node corresponds to the first locus on the chromosome and the accepting state node the last locus on the chromosome, and the number of edges in a path corresponds to the number of SNPs in a chromosome (L), which can be on the order of 50,000 in some embodiments. The thickest portion of the graph (i.e., a locus with the greatest number of possible paths), which depends at least in part on the DNA sequences of individuals used to construct the graph (K), can be on the order of 5,000 in some embodiments. A large number of computations would be needed (O(LK⁴) in the worst case) for a naïve implementation of a dynamic programming solution based on the Viterbi algorithm.

In some embodiments, the paths are pruned at each state of the graph to further improve performance. In other words, only likely paths are kept in the modified graph and unlikely paths are discarded. In some embodiments, after i markers (e.g., 3 markers), paths with probabilities below a certain threshold E (e.g., less than 0.0001%) are discarded. For example, a haplotype along a new path that accounts for both recombination and switching error would have very low probability of being formed, and thus can be discarded. As another example, in the case of unphased genotype data of “AG, CT, GG, CT, GG, CG,” (SEQ ID NO: 2) a new haplotype accounting for recombination can be forged by switching paths several times along the graph (additional edges would need to be added but are not shown in the diagram). Given the low probability associated with each switch, however, the formation of such a haplotype is very unlikely and would be pruned from the resulting graph, while the path that includes the genotyping error 825 has sufficiently high probability, and is kept in the graph and used to thread the unphased genotype data into phased genotype data. By pruning unlikely paths from the modified graph, the dynamic programming-based phasing process is prevented from exploring very unlikely paths in the graph when threading a new haplotype along it. The choice of E determines the trade-off between the efficiency of the algorithm (in both time and space) and the risk of prematurely excluding the best Viterbi path. Computation savings provided by pruning can be significant. In some cases, phasing using a naïve implementation can require 15 days per person while phasing with pruning only requires several minutes per person.

In some embodiments, the nodes and edges of the haplography can be represented as follows:

struct Node {

int32_t id;

int32_t level;

Edge *outgoing[2];

};

struct Edge {

int16_t id;

int8_t allele;

float weight;

Node *to;

}

Even with a pruned haplotype graph, the number of nodes and edges can be large and using the above data structures to represent the graph would require a vast amount of memory (on the order of several gigabytes in some cases). In some embodiments, the graph is represented in a compressed form, using segments. The term “segment” used herein refers to the data structure used to represent the graph in a compressed form and is different from the DNA segments used elsewhere in the specification. Each segment corresponds to a contiguous set of edges in the graph, with the following constraints: the end of the segment has up to 1 branch (0 branches are permitted), and no segment points to the middle of another segment. In some embodiments, the data structure of a segment is represented as follows:

struct Segment {

int32_t timestamp;

int32_t index;

int32_t begin;

int32_t end;

int32_t count[2];

Segment *edges[2];

}

FIG. 9 is a diagram illustrating an embodiment of a compressed haplotype graph with segments. In this example, dashed shapes are used to illustrate the individual segments enclosed within. In some cases, a compressed graph associated with a chromosome can be represented using several megabytes of memory, achieving memory reduction by a factor of 1000 compared to the naïve implementation of nodes and edges.

Trio-Based Phasing

On a system such as the personal genomics services platform provided by 23andMe®, DNA sequence information of one or both parents of the individual is sometimes available and can be used to further refine phasing. With the exception of sites where all three individuals are heterozygous, the parental origin of each allele can be determined unambiguously. For ambiguous sites, knowledge of patterns of local linkage disequilibrium can be used to statistically estimate the most likely phase. In some embodiments, a refinement process that accounts for parental DNA sequence information, referred to as trio-based phasing, is optionally performed following the population-based phasing process to correct any errors in the output of the population-based phasing process and improve phasing accuracy. In some embodiments, the trio-based phasing technique is a post-processing step to be applied to sequences for which a previous population-based linkage-disequilibrium phasing approach has already been applied. The trio-based phasing technique can be used in combination with any existing phasing process to improve phasing quality, provided that an estimate of the switch error rate (also referred to as the phasing error rate) is available.

In some embodiments, trio-based phasing receives as inputs a set of preliminary phased haplotype data (e.g., output of an out-of-sample population-based phasing technique described above), and employs a probabilistic graphic model (also referred to as a dynamic Bayesian network) that models the observed alleles, hidden states, and relationships of the parental and child haplotypes. The input includes the set of preliminary phased haplotype data as well as the phased haplotype data of at least one parent. The genotype data at a particular site (e.g., the i-th SNP on a chromosome) for each individual in the trio (i.e., mom, dad, or child (i.e. the individual whose genetic data is being phased)) are represented by the following variables:

G₀*′^(i),G₁*′^(i)∈{0, 1}: the observed alleles for haplotypes 0 and 1, provided as input data. For the child, the input data can be obtained from the output of the population-based phasing process (e.g., the preliminary haplotype data). For the parent, the input data can be the output of the population-based phasing process or the final output of a refined process.

H_(m)*′^(i), H_(p*′) ^(i)∈{0, 1}: the hidden true alleles of the individual's maternal (m) and paternal (p) haplotypes.

P*′^(i)∈{m, p}: a hidden binary phase indicator variable that is set to m whenever G₀*′^(i) corresponds to H_(m)*′^(i) and set to p whenever G₀*′^(i) corresponds to H_(p)*′^(i).

The relationship between parental and child haplotypes are encoded by two additional variables, T^(mom,i),T^(dad,i)∈{a,b}, where a indicates transmission of the parent's maternal haplotype to the child and b indicates transmission of the parent's paternal haplotype to the child. In some embodiments, a=0 and b=1.

The following assumptions are made about the model:

1. The hidden true alleles for each parent at each position (i.e., H_(*) ^((mom,dad),i)), the initial phase for each individual (i.e., P*′¹), and the initial transmission for each parent (i.e., T*′¹) are independently drawn from uniform Bernoulli priors.

2. The phase indicator variables for each individual and the transmission indicator variables for each parent are each sampled according to independent first order Markov processes. Specifically,

${P\left( P^{*{,i}} \middle| P^{*{,{i - 1}}} \right)} = \left\{ {{\begin{matrix} {1 - s} & {{{if}P^{*{,i}}} = P^{*{,{i - 1}}}} \\ s & {otherwise} \end{matrix}{P\left( T^{*{,i}} \middle| T^{*{,{i - 1}}} \right)}} = \left\{ \begin{matrix} {1 - r} & {{{if}T^{*{,i}}} = T^{*{,{i - 1}}}} \\ r & {otherwise} \end{matrix} \right.} \right.$ where s is the estimated switch error probability between consecutive sites in the input haplotypes and r is the estimated recombination probability between sites in a single meiosis. In some embodiments, s is set to a default value of 0.02 and r is set to a default value of

${\frac{1}{2}\left( {1 - e^{{- 2}{(\frac{3.75}{500000})}}} \right)} \approx {{0.0}0007{5.}}$

3. The hidden true alleles for the child at each position (i.e., H_(*) ^(kid,i)) are deterministically set on the parents' true hidden haplotypes (i.e., neglecting the possibility of private mutations) and their respective transmission variables.

4. The observed alleles are sampled conditionally on the true alleles and the phase variables with genotyping error, according to the following model:

${P\left( {\left. G_{0}^{*{,i}} \middle| H_{m}^{*{,i}} \right.,H_{p}^{*{,i}},P^{*{,i}}} \right)} = \left\{ \begin{matrix} {1 - g} & {{{if}G_{0}^{*{,i}}} = H_{p^{*{,t}}}^{*{,i}}} \\ g & {otherwise} \end{matrix} \right.$ according to the estimated genotyping error rate.

The following expression is used to characterize the trio-based phasing process: maximize Pr(H _(m) ^(kid) ,H _(p) ^(kid) ,H _(m) ^(mom) ,H _(p) ^(mom) ,H _(m) ^(dad) ,H _(p) ^(dad)) given H _(m) ^(i) +H _(p) ^(i) =G ₀ ^(i) G ₁ ^(i) ∀i∈{kid,mom,dad}

FIG. 10 is a diagram illustrating an embodiment of a dynamic Bayesian network used to implement trio-based phasing. The diagram depicts the structure of the dynamic Bayesian network using plate notation. Rounded rectangles (also referred to as plates) such as 1002 and 1004 are used to denote repeated structures in the graph model. Each plate corresponds to a position (e.g., the i-th marker) on the individual's chromosome. In plate 1002 which corresponds to position i−1, variables which are not connected to any variables from other plates (e.g., H_(m) ^(kid,i-1)) are omitted from the diagram. Plate 1004 shows a detailed template for position i∈{1, 2, . . . , L}. As shown, nodes represent random variables in the model, and edges represent conditional dependencies. Shaded nodes (e.g., node 1006) represent random variables which are observed at testing time, and nodes with thickened edges (e.g., node 1008) represent variables which have dependencies across plates.

Trio-based phasing includes using the probabilistic model to estimate the most probable setting of all unobserved variables, conditioned on the observed alleles. In some embodiments, the most probable H variables are determined using a standard dynamic programming-based technique (e.g., Viterbi). One can visualize the model as plates corresponding to i∈{1, 2, . . . , L} being stacked in sequential order, and the paths are formed by the interconnections of nodes on the same plate, as well as nodes across plates.

FIG. 11 is a flowchart illustrating an embodiment of a process to perform trio-based phasing based on the model of FIG. 10 . Process 1100 can be performed on a system such as 100 or 206, and can be used to implement phasing module 302 to perform post-processing of population-based phasing. It is assumed that a model such as 1000 is already established.

At 1102, emission probabilities are precomputed for each plate of model 1000. In some embodiments, the emission probabilities, which correspond to the most likely setting for the H variables given the G, P, and T variables, are found using a dynamic programming (e.g., Viterbi) based process. Referring to FIG. 10 , for a given position i, there are 2 possible settings (0 or 1) for each for the variables P^(mom), P^(kid), P^(dad), T^(mom), T^(dad); there are two possible settings (0 or 1) for each of the six H variables; and there are 3 possible settings (0, 1 or missing) or each of the six G variables, 2⁵*2⁶*3⁶=1.5 million possible combinations. In subsequent steps, a dynamic programming process will search these combinations to identify the most likely setting for the H variables.

At 1104, transition probabilities are computed based at least in part on the values of transition probabilities from the previous position. Referring to FIG. 10 , at a given position i, the values of transition variables T and P are dependent on the values of the T and P variables from the previous position. There are 2 possible settings (0 or 1) for each of the 5 P and T variables in the upper box 1002, and 2 possible settings (0 or 1) for each of the 5 P and T variables in the lower box. The possible combinations of the T and P values are therefore 2⁵*2⁵=1024.

At 1106, based on the computed probabilities, the settings of transition variables T and P across the entire chromosome sequence (i.e., for i=1, . . . , L) are searched to determine the settings that would most likely result in the observed values. In some embodiments, the determination is made using a dynamic programming technique such as Viterbi, and 2⁵*2⁵*L states are searched.

At 1108, the setting of H variables is looked up across the entire sequence to determine the settings that would most likely result in the given G, P, and T variables. This requires L table lookups.

The trio-based phasing solves the most likely settings for the H variables (the hidden true alleles for the individual's maternal and paternal haplotypes at a given location). The solution is useful for phasing the child's DNA sequence information as well as for phasing a parent's DNA sequence information (if the parent's DNA sequence information is unphased initially). In the event that only one parent's DNA sequence information is available, the other parent's DNA sequence information can be partially determined based on the DNA sequence information of the known parent and the child (e.g., if the child's alleles at a particular location is “AC” and the mother's alleles at the same location are “CC”, then one of the father's alleles would be “A” and the other one is unknown). The partial information can be marked (e.g., represented using a special notation) and input to the model. The quality of trio-based phasing based on only one parent's information is still higher than population-based phasing without using the trio-based method.

In addition to improved haplotypes data, the result of trio-based phasing also indicates whether a specific allele is deemed to be inherited from the mother or the father. This information is stored and can be presented to the user in some embodiments.

Local Classification

Local classification refers to the classification of DNA segments as originating from an ancestry associated with a specific geographical region (e.g., Eastern Asia, Scandinavia, etc.) or ethnicity (e.g., Ashkenazi Jew).

Local classification is based on the premise that, T generations ago, all the ancestors of an individual were unadmixed (i.e., originating from the same geographical region). Starting at T generation, ancestors from different geographical regions produced admixed offspring. Genetic recombination breaks chromosomes and recombines them at each generation. After T generations, 2T meiosis occurred. As a result, the expected length of a recombination—free segment is expressed as:

$L = {\frac{F}{2T}{cM}}$ where F corresponds to a fixed length segment. In some embodiments, the expected length L is determined to be 100 SNPs. It is used as the segment size (also referred to as the window size) used in local classification.

FIG. 12 is a flowchart illustrating an embodiment of a local classification process. Process 1200 can be performed on a platform such as 200 or a system such as 300.

Initially, at 1202, a set of K local ancestries is obtained. In some embodiments, the specification of the local ancestries depends on the ancestries of unadmixed individuals whose DNA sequence information is used as reference data. For example, the set of local ancestries can be pre-specified to include the following: African, Native American, Ashkenazi, Eastern Asian, Southern Asian, Balkan, Eastern European, Western European, Middle Eastern, British Isles, Scandinavian, Finnish, Oceanian, Iberian, Greek, Sardinian, Italian, and Arabic. Many other specifications are possible; for example, in some embodiments the set of local ancestries correspond to individual countries such as the UK, Ireland, France, Germany, Finland, China, India, etc.

At 1204, a classifier is trained using reference data. In this example, the reference data includes DNA sequence information of unadmixed individuals, such as individuals who are self-identified or identified by the system as having four grandparents of the same ancestry (i.e., from the same region), DNA sequence information obtained from public databases such as 1 KG, HGDP-CEPH, HapMap, etc. The DNA sequence information and their corresponding ancestry origins are input into the classifier, which learns the corresponding relationships between the DNA sequence information (e.g., DNA sequence segments) and the corresponding ancestry origins. In some embodiments, the classifier is implemented using a known machine learning technique such as a support vector machine (SVM), a neural network, etc. A SVM-based implementation is discussed below for purposes of illustration.

At 1206, phased DNA sequence information of a chromosome of the individual is divided into segments. In some embodiments, phased data is obtained using the improved phasing technique described above. Phased data can also be obtained using other phasing techniques such as BEAGLE. The length of the segments can be a predetermined fixed value, such as 100 SNPs. It is assumed that each segment corresponds to a single ancestry.

At 1208, the DNA sequence segments are input into the trained classifier to obtain corresponding predicted ancestries. In some embodiments, the classifier determines probabilities associated with the set of local ancestries (i.e., how likely a segment is from a particular local ancestry), and the ancestry associated with the highest probability is selected as the predicted ancestry for a particular segment.

In some embodiments, one or more SVMs are used to implement the classifier. An SVM is a known type of non-probabilistic binary classifier. It constructs a hyper plane that maximizes the distance to the closest training data point of each class (in this case, a class corresponds to a specific ancestry). A SVM can be expressed using the following general expression:

$\left\{ \begin{matrix} {{\min\limits_{w,\xi,b}\frac{1}{2}{w}^{2}} + {C{\sum\limits_{i}\xi_{i}}}} \\ {{y_{i}\left( {{w*x_{i}} - b} \right)} \geq {1 - {\xi_{i}{\forall i}}}} \\ {\xi_{i} \geq {0{\forall i}}} \end{matrix} \right.$ where w is the normal vector to the hyper plane, C is a penalty term (fixed), the are slack variables, x_(i) represents the features of the data point i to be classified, and y_(i) is the class of data point i.

FIG. 13 is a diagram illustrating how a set of reference data points is classified into two classes by a binary SVM.

Since an SVM is a binary classifier and there are K (e.g., 18) classes of local ancestries to be classified, the classification can be decomposed into a set of binary problems (e.g., should the sequences be classified as African or Native American, African or Ashkenazi, Native American or Ashkenazi, etc.). One approach is the “one vs. one” technique where a total of (₂ ^(K)) classifiers are trained and combined to form a single local ancestry classifier. Specifically, there is one classifier configured to determine the likelihood that a sequence is African or Native American, another to determine African or Ashkenazi, another to determine Native American or Ashkenazi, etc. During the training process, reference data of DNA sequences and their corresponding ancestries is fed to the SVM for machine learning. When an ancestry prediction for a DNA sequence segment is to be made, each trained SVM makes a determination about which one of the ancestry pair the DNA sequence segment more likely corresponds to, and the results are combined to determine which ancestry is most likely. Specifically, the ancestry that wins the highest number of determinations is chosen as the predicted ancestry. Another approach is the “one vs. all” technique where K classifiers are trained.

Several refinements can be made to improve the SVM. For example, the number of unadmixed reference individuals can vary greatly per ancestral origin. If 700 samples are from Western Europe but only 200 samples are from South Asia, the imbalance in the number of samples can cause the Western European—South Asian SVM to “favor” the larger class. Thus, the larger class is penalized to compensate for the imbalance according to the following:

$\left\{ \begin{matrix} {{\min\limits_{w,\xi,b}\frac{1}{2}{w}^{2}} + {\sum\limits_{G}{C_{G}{\sum\limits_{i}\xi_{i}}}}} \\ {{y_{i}\left( {{w*x_{i}} - b} \right)} \geq {1 - {\xi_{i}\ {\forall i}}}} \\ {\xi_{i} \geq {0{\forall i}}} \end{matrix} \right.$ $C_{G} \propto \frac{1}{❘G❘}$

where w is the normal vector to the hyper plane, CG is a penalty term for class G, the are slack variables, x_(i) represents the features of the data point i to be classified, and y_(i) is the class of data point i.

Another refinement is to encode strings of SNPs according to the presence or absence of features. One approach is to encode one feature at each SNP according to the presence or absence of the minor allele. Another approach is to take substrings of length 2 which have 4 features per position and which can be encoded based on their presence or absence as 00, 01, 10, and 11. A more general approach is to use a window of length L, and encode (L−k+1)·2^(k) features of length k according to the presence or absence of the features.

The general approach is not always feasible for practical implementation, given that there are

$\sum\limits_{k = 1}^{100}{\left( {L - k + 1} \right) \times 2^{k}}$ features in a window of length L. With L=100, this number is approximately 10³⁰, too large for most memory systems. Thus, in some embodiments, a modified kernel is used. In some embodiments, a specialized string kernel is used that computes the similarity between any two given windows as the total number of substrings they share. This approach takes into account that even very similar windows contain sites that have mutated, resulting in common subsequences along with deleted, inserted, or replaced symbols. Therefore, the specialized string kernel is a more relevant way of comparing the similarity between two 100 SNP windows, and achieves much higher accuracy than the standard linear kernel.

Another refinement is to use supervised learning. Supervised learning refers to the task of training (or learning) a classifier using a pre-labeled data, also referred to as the training set. Specifically, an SVM classifier is trained (or learned) using a training set of customers whose ancestry was known (e.g., self-reported ancestries). Parameters of the SVM classifier are adjusted during the process. The trained classifier is then used to predict a label (ancestry) for any new unlabeled data.

Error Correction

The results of the local classifier can contain errors. FIG. 14 is a diagram illustrating possible errors in an example classification result. In this example, a portion of an individual's DNA sequence is phased and locally classified. The classification result 1400 is shown, in which the top portion corresponds to the haplotype inherited from one parent and the bottom portion corresponds to the haplotype inherited from the other parent. Each segment of the individual's DNA is labeled according to the local classifier output as Finland, Ashkenazi, or British Isles. Two types of possible errors are illustrated. Starting at location 1402, the label switched from Finland to Ashkenazi for the first half of the chromosome and from Ashkenazi to Finland for the second half. This switch can be caused by a double recombination, or simply be a phasing error. At locations 1404 and 1406, there are two predictions for segments that correspond to British Isles ancestry. These repeated predictions can be evidence of ancestry changes, or be caused by correlated local classifier (e.g., SVM) prediction errors. Thus, error correction is implemented in some embodiments. In addition, because the output of the SVM tends to be noisy, the error correction process also reconciles these local ancestry estimates and produces cleaner classifications (i.e., smooths out the noise). In some embodiments, confidence scores for the ancestry assignments are also computed.

In some embodiments, error correction is implemented using a Hidden Markov Model (HMM), which is a statistical model in which the input data is being modeled as a Markov process with unobserved (hidden) states. In an HMM, the observed signal (the input data) is being generated by a hidden process in a sequential manner. A standard HMI assumes that an observation, given the hidden state that generated it, is independent of all previous observations. The hidden state at any given position only depends on the hidden state at the previous position. In some embodiments, the input (observed data) to the HMI includes the predicted ancestries of DNA sequence segments (e.g., the ancestries as predicted by the local classifier for segments that are 100 SNPs in length). The hidden state corresponds to the true ancestries of the segments. The output of the HMM forms a set of smoothed ancestry origins for the segments. FIG. 15 is a graph illustrating embodiments of Hidden Markov Models used to model phasing errors. In the example shown, the observed variables O¹, O², O³, and O⁴ correspond to Finland, Finland, British Isles, and British Isles, respectively. The possible values for each hidden state H correspond to the set of local ancestries. Given the observed variables and the probabilities associated with the model, the most likely sequence of hidden states can be solved.

FIG. 16 shows two example graphs corresponding to basic HMMs used to model phasing errors of two example haplotypes of a chromosome. In this example, graph 1602 illustrates an HMI corresponding to one haplotype and graph 1604 illustrates an HMI corresponding to another haplotype. The most likely sequences of the H variables have been solved and the H variables are labeled.

The basic model averages out the output of the learning machine and generates a smoother and less noisy output, but does not correct many of the errors in the output. For example, in FIG. 16 , two HMIs model two haplotypes separately and independently. In practice, however, the switching errors in two haplotypes are not independent but instead occur together. Thus, in some embodiments, the basic HMI is improved by treating the true ancestries associated with two haplotypes at a given location as a single hidden state. FIG. 17 shows an example graph in which one HMI jointly models both haplotypes to account for potential phasing errors. This model is referred to as a Pair Hidden Markov Model (PHMM). In this case, the pair of true ancestries of both haplotypes at a given location is treated as the hidden state at the location. The PHMM accounts for the phasing errors (e.g., error at location 1402 of FIG. 14 ) that are present in the output of the local classifier.

Also, in FIG. 16 , the basic HMMs assume that the observed data are computed independently (in other words, the Os are uncorrelated). In practice, the classification errors are correlated. For example, since long stretches of DNA can be inherited from one generation to the next, the true ancestries of adjacent DNA segments can be correlated. Thus, in some embodiments, the model of FIG. 17 is further improved to model the interdependencies between observed states. The improved model is another type of PHMM, referred to as an Autoregressive Pair Hidden Markov Model (APHMM). FIG. 18 shows an example graph of an Autoregressive Pair Hidden Markov Model (APHMM). In this example, a given observed state O^(i) depends both on its corresponding underlying hidden state H^(i) and on the previous observed state

The graph defines a probabilistic model as follows: =Pr(H ¹ ,H ² ,H ³ , . . . ,O ¹ ,O ² ,O ³, . . . )=Pr(H ¹)Pr(O ¹ |H ¹)Pr(H ² |H ¹)Pr(O ² |H ² ,O ¹)Pr(H ³ |H ²)Pr(O ³ |H ³ ,O ²) . . . . where probabilities P(O^(j)|H^(j), O^(j-1)) are referred to as the emission parameters, and probabilities Pr(H^(i)|H^(i-1)) are referred to as the transition parameters.

The model outputs probabilities associated with ancestry assignments of the most probable sequence. Training is required to estimate the emission parameters and the transition parameters. In some embodiments, an expectation maximization method is used to estimate the parameters.

The emission parameters characterize how well the local classifier predicts the ancestry. Specifically, given the underlying true state of a segment, what is the probability that the local classifier will output the true state. FIG. 19 is an example data table displaying the emission parameters. The data table can be generated based on empirical data of the local classifier's output and reference data of unadmixed individuals. For example, suppose there are 1000 individuals in the reference population who have identified themselves as unadmixed Ashkenazis. The local classifier output, however, labels 1% of these individuals' segments as African, 3% as Native American, 40% as Ashkenazi, etc. Thus, P (O=African|H=Ashkenazi) is 1%, P (O=Native American|H=Ashkenazi) is 3%, P (O=Ashkenazi|H=Ashkenazi) is 40%, etc. These values are used to fill the corresponding entries in the table. The values for emission parameters are found along the diagonal of the table.

The transition parameters correspond to the probability of a particular hidden state of the model given the previous hidden state. They represent the statistical likelihood of observing certain sequences of true ancestries in the population, and therefore need to be determined based on admixed data. However, it is not possible to obtain fully transitioned and accurately labeled genomes from actual admixed individuals. Thus, to determine the transition parameters, an iterative approach is used. Initially, the transition parameters are arbitrarily chosen to establish an initial model. The initial model is used to perform error correction. Based on the error corrected results, the model is updated by applying an expectation maximization method. The process can be repeated until a final convergent model is achieved.

Once the emission parameters and the transition parameters are established, the model is fully specified. Thus, the most likely sequence of hidden variables can be determined based on the observed states using conventional HMI techniques. For example, a probabilistic scoring scheme is used to determine the most likely sequence in some embodiments. All the possibilities associated with the hidden states are listed, and a set of scoring rules are specified to reward or penalize certain events by adding or subtracting a score associated with a sequence. For example, a change in adjacent haplotypes is likely an error; therefore, whenever two adjacent haplotypes are different, the score is reduced according to the rules. A mismatched observed state/hidden state pair also indicates likely error; therefore, whenever there is a mismatch of predicted ancestry and the underlying ancestry, the score is reduced. The most likely sequence of hidden states can be determined by computing scores associated with all possible combinations of observed states and hidden states, and selecting the sequence that leads to the highest score. In some embodiments, more efficient techniques for selecting the most likely sequence such as dynamic programming are employed to break the problem down into subproblems and reduce the amount of computation required. For example, the problem can be reduced to recursively determine the best ancestry assignment for everything to the left or the right of a particular position.

As described above, training is required to obtain parameters for the PHMM (or APHMM). In some embodiments, an ensemble technique is used where reference population is grouped into distinct subsets to serve as different types of training data resulting in different types of models. For example, different types of reference individuals that tend to have similar ancestries are identified and grouped into subsets. Such subsets can be formed from admixed individuals (e.g., Latinos, Eurasians, etc.). as well as unadmixed individuals (e.g., East Asians, Northern Europeans, etc.) Data from a subset is used to determine the parameters of the model for that subset. The resulting model is a model specific to the reference group (e.g., a Latino-specific model, a Eurasian-specific model, an East Asian specific-model, a Northern European-specific model, etc.). In some embodiments, the error correction process applies its input to all available models, and the results are weighted based on confidence measures and then combined according to a Bayesian model averaging technique.

FIGS. 20A-20D are ancestry assignment plots illustrating different results that are obtained using different techniques. FIG. 20A is an example plot of ancestry assignments of two simulated haplotypes of a chromosome of a simulated individual. Each pattern in the haplotype represents a corresponding ancestry origin. This plot is referred to as the true ancestries of the haplotypes. This data is input into different types of ancestry assignment modules and the outputs are compared. First, the data is input into a local classifier without error correction to generate an output that corresponds to FIG. 20B. As can be seen, the output is very noisy, where an underlying region that actually only corresponds to a single ancestry is given many ancestry assignments by the local classifier. The local classifier output is input into a basic HMI (e.g., the HMI of FIG. 16 ) that performs an averaging and corrects for the noise in the local classifier output, one haplotype at a time, to generate an output that corresponds to FIG. 20C. The HMI corrects some of the noise in the local classifier output, but does not correct phasing errors or correlated classifier errors, and therefore the result does not perfectly resemble the true ancestry assignments of the two haplotypes. The local classifier output is also input into an HMI that corrects for noise, phasing errors and correlated classifier errors (e.g., the PHMM of FIG. 18 or the APHMM of FIG. 19 ) to generate an output that corresponds to FIG. 20D. The output perfectly matches the true ancestries of the underlying haplotypes (even though the order of the haplotypes are reversed in the output).

FIG. 21 is a table comparing the predictive accuracies of ancestry assignments with and without error correction. The “before” columns show the recall and the precision associated with unadmixed or admixed individuals using a basic HMM. The “after” columns show the recall and the precision associated with unadmixed or admixed individuals using APHMM. As used herein, recall refers to what proportion of a particular ancestry is correctly predicted, and precision refers to what proportion of a particular ancestry prediction is correct. For example, if 20% of the underlying reference data corresponds to African ancestry, and the assignment technique predicts that a given haplotype segment corresponds to African ancestry 10% of the time, then recall refers to the portion of the 20% of the African ancestry that is correctly predicted, and precision refers to the portion of the 10% of the African ancestry predictions that in fact corresponds to true African ancestry. As can be seen, recall and prediction of both unadmixed individuals and admixed individuals are improved post-error correction.

Recalibration

The error correction module outputs the most probable sequence of ancestry assignments for a pair of haplotypes, and posterior probabilities associated with the corresponding assignments. The posterior probabilities are recalibrated to establish confidence measures associated with the ancestry assignments. A well calibrated prediction with a probability of P should be correct P of the times. How well the posterior probability of the output is calibrated can be determined based on reference data of actual unadmixed individuals and/or simulated admixed individuals. For example, if it is known that in the reference data, 10% of the haplotype segments correspond to East European ancestry, but the output predicts with 80% posterior probability that 20% of all the haplotype segments correspond to East European ancestry, then the posterior probability is overly confident. By tallying the percentage of the reference data that corresponds to a specific ancestry, and applying the reference data to the predictive engine to obtain the posterior probability, a reliability plot of accuracy vs. posterior probability can be determined for each reference population corresponding to a specific ancestry. FIG. 22A illustrates example reliability plots for East Asian population and East European population before recalibration. In the example plots shown, lines 2202 and 2204 indicate the ideal accuracy—posterior probabilities correspondence, and lines 2206 and 2208 indicate the actual accuracy—posterior probabilities correspondence. Other reliability plots can be similarly determined.

In some embodiments, Platt's recalibration technique is used to recalibrate the posterior probabilities. Logistics regression is applied to posterior probabilities. A feature matrix X (e.g., 2^(nd) degree polynomials) is defined, and a fit is determined based on the following:

${\Pr\left( {y = \left. 1 \middle| X \right.} \right)} = \frac{1}{1 + {\exp\left( {X\theta} \right)}}$

K-class recalibration is then performed (K being the number of local ancestries). In some embodiments, K logistic curves are fit and renormalized. In some embodiments, K logistic curves are fit and multinomial logistic regression (i.e., softmax) is performed according to the following:

${\Pr\left( {y = \left. i \middle| X \right.} \right)} = {\frac{\exp\left( {X\theta_{i}} \right)}{1 + {\sum\limits_{k = 1}^{K - 1}{\exp\left( {X\theta_{i}} \right)}}}{\forall{i \leq K}}}$

FIG. 22B illustrates example reliability plots for East Asian population and East European population after recalibration. It is worth noting in the original East European plot of FIG. 22A, when the posterior probability exceeds 60%, the accuracy is very poor. Thus, in the calibrated result for East European population shown in FIG. 22B, accuracy is clipped at 60%.

In some embodiments, an isotonic regression technique (e.g., the Zadrozny and Elkan method) is used to recalibrate the posterior probabilities, where recalibrated probabilities are estimated as percentages of well classified training examples falling in each bin.

Given the input of (y_(i), p_(i))_(i)=1, . . . , n, the input is sorted in increasing order of p_(i). ϕ_(i) that monotonically increases with p_(i) but close to y_(i) are found. In some embodiments, a pool-adjacent-violators (PAV) algorithm is used to solve:

$\min\limits_{\phi_{1},\ldots,\phi_{n}}{\sum\limits_{i = 1}^{n}{\omega_{i}\left( {y_{i} - \phi_{i}} \right)}^{2}}$ ϕ₁ ≤ ϕ₂ ≤ … ≤ ϕ_(n) where y_(i) is the label predicted for individual i, p_(i) is the uncalibrated probability associated with the prediction and ϕ_(i) is the recalibrated probability.

In some embodiments, modified isotonic regression techniques are used. For example, p_(i) can be bracketed into bins, and weights proportional to the bin sizes are introduced to reduce computational cost. As another example, regularization terms can be introduced to ensure smoothness of the output curves as follows:

${\min\limits_{\phi_{1},\ldots,\phi_{n}}{\sum\limits_{i = 1}^{n}{\omega_{i}\left( {y_{i} - \phi_{i}} \right)}^{2}}} + {C{\sum\limits_{i = 1}^{n - 1}\left( {\phi_{i} - \phi_{i + 1}} \right)^{2}}}$ ϕ₁ ≤ ϕ₂ ≤ … ≤ ϕ_(n)

In some embodiments, separate calibration regimes are used for individuals with different amounts of effective switch error. Specifically, separate calibration curves are fitted for unadmixed individuals (who have a low rate of effective switching error) or admixed individuals (who have a high rate of effective switching error).

Label Clustering

In some embodiments, the recalibrated results are required to meet a threshold level of confidence before they are presented to the user. If the threshold level is unmet, the assignments are clustered and repeated as necessary until a total confidence level meets the threshold level. FIG. 23A is a flowchart illustrating an embodiment of a label clustering process. Process 2300 can be performed on a platform such as 200 or a system such as 300. At 2302, calibrated posterior probabilities of predicted ancestries associated with a haplotype segment are obtained (for example, as output of the calibration module). At 2304, the calibrated posterior probabilities are sorted according to their values. At 2306, it is determined whether the calibrated posterior probability with the highest value meets the threshold. If so, the ancestry associated with the highest calibrated posterior probability is deemed to be the ancestry of the haplotype segment and is output (e.g., presented to the user) at 2308. If, however, the threshold is not met, then, at 2310, the probabilities are clustered (e.g., summed) to form one or more new probabilities associated with broader geographical regions, and the new probabilities are clustered again at 2304. 2304-2310 are repeated until the threshold is met and a predicted ancestry of sufficiently high confidence is presented to the user.

FIG. 23B is an example diagram illustrating process 2300 of FIG. 23A. In this example, geographical locations associated with different ancestries are organized into a hierarchical tree. The root node of the tree is the world (a segment that is labeled the world means that the segment is unclassified). The next level corresponds to the continents. The next level under the continents corresponds to subcontinents. The next level corresponds to individual countries or specific geographical regions within each subcontinent. Other representations are possible. The calibrated posterior probabilities of predicted ancestries associated with the haplotype segment are as follows: 5% probability of being Oceania, 60% probability of being British Isles, 20% probability of being West Europe, 15% probability of being Greece. Depending on the value set for the threshold, different predicted ancestries can be presented. For example, if the probability is set at 60%, the ancestry of British Isles is deemed to be associated with the segment and is presented to the user. If the threshold is set at 70%, then none of the current ancestry labels meets the threshold level. Thus, the probabilities associated with specific countries or regions are clustered into subcontinents and the probabilities are summed. As shown, the probabilities associated with the British Isles and West Europe are clustered to form a probability indicating that the segment is 80% likely to be North-West European in its origin. The segment would therefore be labeled as North-West European. If, however, the threshold is set at 90%, then even at this level, no probability associated with a single node of the hierarchical tree meets the threshold. Thus, the probabilities are clustered again, combining the probabilities of North-West Europe and South Europe to form a probability that the segment is 95% likely to be from Europe. Europe is then presented as the predicted ancestry associated with the segment. As shown, if a segment cannot meet the threshold at the continental level, it is deemed to be world/generic.

The output of the label cluster outputs the predicted ancestry for each haplotype segment. In some embodiments, the information is stored in a database and/or sent to an application to be displayed.

Display of Ancestry Composition Information

In some embodiments, once the ancestries associated with the individual's chromosomes are determined, the results can be presented via various user interfaces upon user requests. The user interfaces can also present ancestry information obtained using other techniques so long as the data being presented includes requisite information such as the specific ancestries and proportions of the individual's genotype data that corresponds to the specific ancestries.

FIG. 24 is a flowchart illustrating an embodiment of a process for displaying ancestry information. Process 2400 can be performed on a platform such as 200 or a device such as 100.

At 2402, a request to display ancestry composition of an individual is received. In some embodiments, the request is received from an application that allows users to interact with their genetic information and/or ancestry data. Referring to FIG. 2 as an example, a user can make a request to display ancestry information via an application (e.g., a standalone application or a browser-based application) installed on client device 202. The application provides user interfaces (e.g., buttons, selection boxes, or other appropriate user interface widgets) as well as associated logic to interact with ancestry prediction system 206 and/or process data. The user can be the individual or another person with permission to view the individual's ancestry information.

Returning to FIG. 24 , at 2404, upon receiving the request and in response, ancestry composition information of the individual is obtained. The ancestry composition information includes information pertaining to proportions of the individual's genotype data deemed to correspond to specific ancestries. In some embodiments, the ancestry composition information includes hierarchical information of different geographical regions (e.g., 40% of the individual's genome corresponds to European ancestry, of which 80% corresponds to North-Western European ancestry and 20% corresponds to Southern European ancestry; of the North-Western European ancestry, 30% corresponds to Finish ancestry and 70% corresponds to Scandinavian ancestry; of the Southern European ancestry, 50% corresponds to Italian ancestry and 50% corresponds to Greek ancestry, etc.). In some embodiments, the ancestry composition information is obtained directly from a source such as a database or the output of a pipelined ancestry prediction process. In some embodiments, raw data obtained from a source is further processed to obtain ancestry composition information. For example, if the raw data only includes predicted ancestry composition information per haplotype segment, then the segments and their ancestries are tallied to determine the proportions of the individual's genes that are deemed to correspond to the specific ancestries (e.g., 1000 out of 5000 segments are deemed to correspond to Italian ancestry and therefore 20% of the individual's genes are deemed to correspond to Italian ancestry).

At 2406, the ancestry composition information is presented to be displayed via a user interface.

In some embodiments, the ancestry composition information is initially displayed according to geographical regions and proportions of ancestries deemed to correspond to those geographical regions. Subsequently, the user can request different data to be displayed via user interfaces provided by the application. A further user request is optionally received at 2408. At 2409, the type of request is determined. In response to the further user request and depending on the type of request, different information is displayed. As shown, if the user request is a request to display subregions of a specific ancestry, subregions and proportions of the individual's ancestries corresponding to the subregions are displayed (or caused to be displayed on a display device by processors) at 2410 in response. If the user request is a request to display ancestries inherited from one or more parents, such information is displayed (or caused to be displayed) at 2412 if available. If the user request is a request to display ancestry composition information for a specific chromosome, the proportions of ancestries associated with the specific chromosome is displayed (or caused to be displayed) at 2414. Other types of requests/displays are possible.

FIG. 25 is a diagram illustrating an embodiment of a regional view of ancestry composition information for an individual. In this example, proportions of the individual's autosomal chromosome segments that correspond to specific continents are displayed. The information is presented to the user using two different views: a circle view 2502 displaying the proportions as sections on a circle, where different visual formats (e.g., colors and/or patterns) represent different ancestral continents; and a list view 2504 displaying the proportions and corresponding continent names. Other views are possible (e.g., a map view displaying the regions associated with the ancestries).

The user is provided with the ability to expand the regions and view more detailed information pertaining to subregions. FIG. 26 . is a diagram illustrating an embodiment of an expanded view of ancestry composition information for an individual. In this example, the user can request to expand the circle view by moving a cursor or other pointing mechanism over a section of the circle view (e.g., European section 2602), or by clicking on an entry in the list view (e.g., European entry 2604). In response, the application expands the section and/or the entry in the list to show subregions of ancestries for the individual. In some embodiments, the subregions are determined according to the hierarchical information of the ancestry composition information. In the example shown, a new section 2604 is created to include three subregions of Europe (Northwest Europe, South Europe, and Generic Europe) from which the individual's ancestries can be traced as well as proportions of the individual's DNA attributed to these subregions, and additional entries 2606 are created to list the subregions and the proportions.

The subregions can be further expanded. FIG. 27 is a diagram illustrating an embodiment of a further expanded view of ancestry composition information for an individual. In this example, the user can request to expand the circle view by moving the cursor or other pointing mechanism over a subregion section (e.g., Northwest Europe section 2702), or by clicking on an entry in the list view (e.g., Northwest Europe entry 2704). In response, the application expands the subregion section and/or the entry to show more detailed composition. In this example, the Northwest European ancestry is shown to include ancestries from British Isles, Scandinavia, and generic Northwest Europe. The process can be repeated as long as more granular data is available.

In some embodiments, the ancestry composition information that is obtained includes inheritance information, including proportions of the individual's ancestries that are deemed to be inherited from either the father or the mother. In other words, the inheritance information pertains to how much of the individual's DNA corresponding to a specific ancestry is inherited from each parent. For example, the trio-based phasing result can indicate that for chromosome 1, haplotype 0, segments 1-20 correspond to Scandinavian ancestry and are inherited from the mother, segments 21-45 correspond to Italian ancestry and are inherited from the mother also, segments 46-73 correspond to Greek ancestry and are inherited from the father, and so on. The segments from either the mother or the father and the corresponding ancestries of the segments are tallied, and proportions of the ancestries attributed to each parent are computed. The inheritance information computation can be done following trio-based phasing, at the time the request to display inheritance from parents is made, or at some other appropriate time. Ancestry composition information of how much of the individual's DNA corresponding to a specific ancestry is inherited from each parent is displayed. FIG. 28 is a diagram illustrating an embodiment of an inheritance view. In this example, the view is divided into two areas shown side-by-side. Area 2802 shows ancestries inherited from the father and area 2804 shows ancestries inherited from the mother. A continent-level view of ancestry composition attributed to each parent is shown initially. For example, 49.1% of the individual's DNA is deemed to correspond to sub-Saharan African ancestry, of which 3.9% is inherited from the father and 45.2% is inherited from the mother. The user is provided with the options to selectively view subregions in similar manners as described in connection with FIGS. 25-27 .

In some embodiments, since the ancestry deconvolution process is applied to individual chromosomes and the results are stored on the basis of individual chromosomes, the user has the option to select a specific autosomal chromosome or an X-chromosome to view its ancestral composition. FIGS. 29-30 are diagrams illustrating embodiments of a chromosome-specific view. In FIG. 29 , a list of the autosomal chromosomes (and/or X-chromosome) that has undergone ancestry deconvolution is presented to the user. Only 8 chromosomes are displayed in the figure but more are available. The user has the option to select a specific one to view its ancestral composition. Upon receiving the user selection (e.g., chromosome 1), in FIG. 30 , ancestry compositions associated with the selected chromosome are displayed in response. Although a list view is shown, other views such as the circle view shown in the preceding diagrams can also be presented. Subregions and inheritance of ancestries from a particular parent can be shown in similar manners as described in connection with FIGS. 25-28 .

A pipelined ancestry deconvolution process and display of results have been described. The accuracy of ancestry predictions is greatly improved over existing techniques, and the results are presented in an informative and user-friendly fashion.

Although the foregoing embodiments have been described in some detail for purposes of clarity of understanding, the invention is not limited to the details provided. There are many alternative ways of implementing the invention. The disclosed embodiments are illustrative and not restrictive. 

What is claimed is:
 1. A pipelined ancestry prediction system, the system comprising: one or more processors and one or more memories coupled to the one or more processors, wherein the one or more processors are configured to: obtain a first set of phased haplotype data of an individual attributed to a first parent and a second set of phased haplotype data of the individual attributed to a second parent; divide the first set of phased haplotype data inherited from the first parent into a first sequence of haplotype windows and the second set of phased haplotype data inherited from the second parent into a second sequence of corresponding haplotype windows, wherein each haplotype window at a genomic location of the first sequence of haplotype windows is paired with a corresponding haplotype window at a same genomic location of the second sequence of haplotype windows, each haplotype window comprising a plurality of genetic markers; assign, using a learning machine, an initial ancestry classification to each haplotype window; generate a sequence of observed states, wherein each observed state is an ordered pair of initial ancestry classifications of two haplotype windows at a same genomic location of the first and second sequences of haplotype windows; provide the sequence of observed states as input to a Paired Hidden Markov Model (PHMM) and obtain a sequence of hidden states as output of the PHMM, wherein each hidden state of the sequence of hidden states is an ordered pair of true ancestry classifications of two haplotype windows at a same genomic location of the first and second sequences of haplotype windows; and obtain corrected ancestry classifications for the first and second sequences of haplotype windows using the sequence of hidden states.
 2. The system of claim 1, the one or more processors are further configured to train the PHMM using training data.
 3. The system of claim 1, wherein each haplotype window has a same window size.
 4. The system of claim 1, wherein the PHMM comprises an Autoregressive Paired Hidden Markov Model (APHMM), and wherein each observed state at a position in the sequence of observed states depends on its underlying hidden state and depends on at least one observed state at a previous position in the sequence of observed states.
 5. The system of claim 1, wherein the one or more processors are further configured to perform label clustering.
 6. The system of claim 5, wherein: the corrected ancestry classifications are associated with posterior probabilities; and to perform label clustering comprises to: determine whether a posterior probability with highest value meets a threshold; and when the threshold is not met, cluster at least some of the posterior probabilities to form a new probability associated with a broader geographical region.
 7. The system of claim 1, wherein the learning machine comprises a neural network.
 8. The system of claim 1, wherein the learning machine comprises a support vector machine (SVM).
 9. The system of claim 1, wherein each haplotype window comprises 100 single nucleotide polymorphisms (SNPs).
 10. A method, implemented using a computer comprising system memory and one or more processors, the method comprising: obtaining a first set of phased haplotype data of an individual attributed to a first parent and a second set of phased haplotype data of the individual attributed to a second parent; dividing the first set of phased haplotype data inherited from the first parent into a first sequence of haplotype windows and the second set of phased haplotype data inherited from the second parent into a second sequence of corresponding haplotype windows, wherein each haplotype window at a genomic location of the first sequence of haplotype windows is paired with a corresponding haplotype window at a same genomic location of the second sequence of haplotype windows, each haplotype window comprising a plurality of genetic markers; assigning, using a learning machine, an initial ancestry classification to each haplotype window; generating a sequence of observed states, wherein each observed state is an ordered pair of initial ancestry classifications of two haplotype windows at a same genomic location of the first and second sequences of haplotype windows; providing the sequence of observed states as input to a Paired Hidden Markov Model (PHMM) and obtaining a sequence of hidden states as output of the PHMM, wherein each hidden state of the sequence of hidden states is an ordered pair of true ancestry classifications of two haplotype windows at a same genomic location of the first and second sequences of haplotype windows; and obtaining corrected ancestry classifications for the first and second sequences of haplotype windows using the sequence of hidden states.
 11. The method of claim 10, further comprising training the PHMM using training data.
 12. The method of claim 10, wherein each haplotype window has a same window size.
 13. The method of claim 10, wherein the PHMM comprises an Autoregressive Paired Hidden Markov Model (APHMM), and wherein each observed state at a position in the sequence of observed states depends on its underlying hidden state and depends on at least one observed state at a previous position in the sequence of observed states.
 14. The method of claim 10, further comprising performing label clustering.
 15. The method of claim 14, wherein: the corrected ancestry classifications are associated with posterior probabilities; and performing label clustering comprises: determining whether a posterior probability with highest value meets a threshold; and when the threshold is not met, clustering at least some of the posterior probabilities to form a new probability associated with a broader geographical region.
 16. The method of claim 10, wherein the learning machine comprises a neural network.
 17. The method of claim 10, wherein the learning machine comprises a support vector machine (SVM).
 18. A non-transitory machine-readable medium having stored thereon program code that, when executed by one or more processors of a computer system, cause the computer system to perform operations for classifying ancestry of genotype data, said program code comprising code for: obtaining a first set of phased haplotype data of an individual attributed to a first parent and a second set of phased haplotype data of an individual attributed to a second parent; dividing the first set of phased haplotype data inherited from the first parent into a first sequence of haplotype windows and the second set of phased haplotype data inherited from the second parent into a second sequence of corresponding haplotype windows, wherein each haplotype window at a genomic location of the first sequence of haplotype windows is paired with a corresponding haplotype window at a same genomic location of the second sequence of haplotype windows, each haplotype window comprising a plurality of genetic markers; assigning, using a learning machine, an initial ancestry classification to each haplotype window; generating a sequence of observed states, wherein each observed state is an ordered pair of initial ancestry classifications of two haplotype windows at a same genomic location of the first and second sequences of haplotype windows; providing the sequence of observed states as input to a Paired Hidden Markov Model (PHMM) and obtaining a sequence of hidden states as output of the PHMM, wherein each hidden state of the sequence of hidden states is an ordered pair of true ancestry classifications of two haplotype windows at a same genomic location of the first and second sequences of haplotype windows; and obtaining corrected ancestry classifications for the first and second sequences of haplotype windows using the sequence of hidden states. 